<template>
	<view class="bg-white">
		<cu-custom bgColor="bg-E96141" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">健康资讯详情</block>
		</cu-custom>
		
		<view class="news-con">
			<view class="cover-img-con">
				<image class="cover-img" :src="newsEn.coverImg" mode="widthFix"></image>
			</view>
			<view class="text-con">
				<view class="title">{{newsEn.title}}</view>
				<view>
					<text class="author">{{newsEn.author}}</text>
					<text class="issue-time">{{newsEn.createTime}}</text>
					<text class="click-count">{{newsEn.clickCount>0?newsEn.clickCount:0}}人阅读</text>
				</view>
			</view>
			<view class="detail-text" v-html="newsEn.content"></view>
		</view>
	</view>
</template>

<script>
	
	export default {
		name: "newsDetail",
		data() {
			return {
				newsEn:{
					id: '',
					title:'', 
					author: '',
					createTime:'',
					clickCount: 0,
					coverImg:'',
					content: ''
				},
			};
		},
		onLoad: function (option) {
			this.id = option.id?option.id:''
			if(this.id){
				this.loadDetail()
			}
		},
		computed: {
		},
		methods: {
			//查看详情
			loadDetail(){
				uni.showLoading({
					title:'加载中...',
					mask:true
				})
				let _params = {
					id:this.id
				}
				let that = this
				that.$http.get("/healthcms/cmsNews/queryById",{params:_params}).then(res=>{
					if(res.data.success){
						uni.hideLoading()
						that.newsEn = res.data.result
					}else{
						uni.hideLoading()
					}
				}).catch(err => {
					uni.hideLoading()
				});
			},
			//返回
			onGoBack() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.cu-form-group .title {
		min-width: calc(4em + 15px);
	}
	
	/* 新闻公告 */
	.news-con{
		.cover-img-con{
			height: auto;
			overflow: hidden;
			image{
				width: 100%;
			}
		}
		.text-con{
			font-size: $uni-font-size-sm;
			color: $uni-color-subtitle;
			overflow: hidden;
			border-bottom: 1px dashed #ececec;
			padding: 10upx 15upx 25upx 15upx;
			margin-bottom: 25upx;
			.title{
				text-overflow: ellipsis;
				white-space: nowrap;
				overflow: hidden;
				font-size: 40upx;
				color: #666666;
				font-weight: 700;
				margin-bottom: 16upx;
			}
			.author{
				margin-right: 24upx;
			}
			.issue-time{
				margin-right: 24upx;
			}
			.click-count{
				float: right;
			}
		}
		.detail-text{
			padding: 0 20upx 20upx 20upx;
			text-align: justify;
			font-size: $uni-font-size-paragraph;
			line-height: 30px;
		}
		.rich-con{
			font-size: $uni-font-size-paragraph;
		}
	}
</style>
